/**
 * Created by zhangsong on 2019/9/23.
 */

import locale, {
  formatMessage as oldFormatMessage,
  FormattedMessage as oldFormattedMessage,
  getLocale as oldGetLocale,
  setLocale as oldSetLocale,
} from 'umi-plugin-react/locale';

export const formatMessage = obj => {
  if (typeof obj === 'string') {
    return oldFormatMessage({ id: obj });
  }
  return oldFormatMessage(obj);
};

export const getLocale = oldGetLocale;
export const setLocale = oldSetLocale;
export const FormattedMessage = oldFormattedMessage;

export default locale;
